const {pool,router,Result} = require('../controller');

// console.log(router);
router.get('/',(req,res)=>{
   pool.getConnection((err,conn)=>{
       console.log("res",req.query.name,req.query.phone);
       const name = req.query.name;
       const phone = req.query.phone;
       if (name!==""&&name !==null&&name!==undefined){
       conn.query('SELECT  * FROM students WHERE name ="'+name+'" and phone = "'+phone+'"',(e,r)=>{
           if (e){
               res.json(new Result({code:0})); 
               console.log("e",e);
           } else {
              const ret = res.json(new Result({data:r}));
            
              console.log("ret",r);
           }
       } );
       
    }else{
        return 
    }
   })
});
module.exports = router;